package o;

import android.net.Uri;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.offline.DownloadException;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;

public abstract class ahp {
    public final Uri ˊ;
    public final int ˋ;
    public final String ˎ;
    public final boolean ˏ;
    public final byte[] ॱ;

    public static abstract class c {
        public final String ˋ;
        public final int ॱ;

        public abstract ahp ˎ(int i, DataInputStream dataInputStream) throws IOException;
    }

    protected abstract void ˊ(DataOutputStream dataOutputStream) throws IOException;

    public abstract ahu ˏ(aht o_aht);

    public static ahp ˏ(c[] cVarArr, InputStream inputStream) throws IOException {
        DataInputStream dataInputStream = new DataInputStream(inputStream);
        String readUTF = dataInputStream.readUTF();
        int readInt = dataInputStream.readInt();
        for (c cVar : cVarArr) {
            if (readUTF.equals(cVar.ˋ) && cVar.ॱ >= readInt) {
                return cVar.ˎ(readInt, dataInputStream);
            }
        }
        throw new DownloadException("No deserializer found for:" + readUTF + ", " + readInt);
    }

    public static void ˋ(ahp o_ahp, OutputStream outputStream) throws IOException {
        DataOutputStream dataOutputStream = new DataOutputStream(outputStream);
        dataOutputStream.writeUTF(o_ahp.ˎ);
        dataOutputStream.writeInt(o_ahp.ˋ);
        o_ahp.ˊ(dataOutputStream);
        dataOutputStream.flush();
    }

    public final byte[] ˊ() {
        OutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        try {
            ˋ(this, byteArrayOutputStream);
            return byteArrayOutputStream.toByteArray();
        } catch (IOException e) {
            throw new IllegalStateException();
        }
    }

    public boolean ॱ(ahp o_ahp) {
        return this.ˊ.equals(o_ahp.ˊ);
    }

    public boolean equals(@Nullable Object obj) {
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        ahp o_ahp = (ahp) obj;
        if (this.ˎ.equals(o_ahp.ˎ) && this.ˋ == o_ahp.ˋ && this.ˊ.equals(o_ahp.ˊ) && this.ˏ == o_ahp.ˏ && Arrays.equals(this.ॱ, o_ahp.ॱ)) {
            return true;
        }
        return false;
    }

    public int hashCode() {
        return (((this.ˏ ? 1 : 0) + (this.ˊ.hashCode() * 31)) * 31) + Arrays.hashCode(this.ॱ);
    }
}
